document.write("<style type='text/css'>");
document.write("html body {width:auto;}");
document.write("#header{width:930px;margin:0 auto;margin-bottom:10px;}");
document.write("#footer{width:930px;margin:0 auto;}");
document.write(".miniWin_mask { z-index: 9999; display: none; position: absolute; top: 0; left: 0; -moz-opacity: 0.5; opacity: .50; filter: alpha(opacity = 50); background-color: #CCC; }");
document.write(".miniWin_win { z-index: 10000; display: none; position: absolute; width: 400px; height: 430px; }");
document.write("</style>");
document.write("<div id=\"miniWin_mask\" class=\"miniWin_mask\"></div>");
var MiniWin = function (config) {
    var winId = config.winId || "miniWin_win";
    var winFlag = false;
    var mask = document.getElementById("miniWin_mask");
    var win = document.getElementById(winId);
    if (!win) {
        document.write("<div id=\"" + windId + "\"></div>");
        win = document.getElementById(winId);
    }
    win.className = "miniWin_win";
    this.show = function (scope) {
        winFlag = true;
        document.body.onresize = function () {
            scope.relocation();
        };
        scope.relocation();
    };
    this.hide = function () {
        mask.style.display = "none";
        win.style.display = "none";
        winFlag = false;
    };
    this.relocation = function () {
        if (winFlag) {
            win.style.display = "block";
            var left = document.body.scrollLeft + document.documentElement.scrollLeft + (document.body.clientWidth - win.offsetWidth) / 2;
            left = left > 0 ? left : 0;
            //var top = document.body.scrollTop + document.documentElement.scrollTop + (document.body.clientHeight - win.offsetHeight) / 2;
            var top = 50;
            top = top > 0 ? top : 0;
            win.style.left = left + "px";
            win.style.top = top + "px";
            mask.style.display = "block";
            mask.style.width = document.documentElement.clientWidth + "px";
            var maskheight= document.body.scrollHeight > document.body.clientHeight ? document.body.scrollHeight : document.body.clientHeight;
            if(maskheight<document.documentElement.clientHeight){
            mask.style.height = document.documentElement.clientHeight + "px";
            }else{
            mask.style.height = maskheight + "px";
            }
            if(maskheight < 510){
                mask.style.height = "550px";
            }
            duilian(winId);
        }
    };
};
function duilian(winId){
	var duilianwin = document.getElementById(winId);
	if(duilianwin != null) {
		duilianwin.style.top=(document.documentElement.scrollTop+document.documentElement.clientHeight-500) + "px";
	}
}